<template>
  <hr>
  <h3>this is third component</h3>
  {{ title }}
  <input type="text" v-model="title">
  <br>
  {{ user.name }} --- {{ user.age }}
</template>

<script>
import {inject} from "vue";

export default {
  name: "ThirdComp",
  //这种方式只能在本组件响应式，在子孙组件中不行
  // inject: ['title']
  setup() {
    //不旦是响应式，而且是可逆的，子孙影响父祖
    let title = inject('title')
    let user = inject('user')
    return {
      title,
      user
    }
  }
}
</script>

<style scoped>

</style>
